<?php
// +----------------------------------------------------------------------
// | 店铺运费值
// +----------------------------------------------------------------------
namespace app\common\model;
use think\Model;

class ShopFreightValue extends Model
{
	
	protected $name = 'freight_cost';
	
    /**
     * 获取运费
     * @param type $shopId
     * @return type
     */
	public function getPostage($freight_id,$province)
    {
		$value = self::where("freight_id",$freight_id)
			->where("province",$province)
			->page(1,1)
			->value('postage');
			
		if($value===null){
			$value = self::where("freight_id",$freight_id)
				->where("province",'其他')
				->page(1,1)
				->value('postage');
		}
		
		return $value ?: 0;
    }
	
}
